const mongoose = require('../config/db/mongo');
const moment = require('moment');
const Schema = mongoose.Schema;
const schemaOptions = {
        versionKey: false
    }
    /**
     *
     * 门店数据模型
     * 
     *
     */
const adminUser = new Schema({


    account: String,
    password: String,
    loggedIn: [],
    lastTimeLoggedIn: Date,
    role: [{ type: mongoose.SchemaTypes.ObjectId, ref: 'role' }], // 第一个用户需要人工创建
    isDelete: Number
}, schemaOptions);

// methods ====================== 提高数据库检索速度 按顺序
adminUser.index({ account: 1 });
adminUser.index({ isDelete: 1 });

// create the model for users and expose it to our app
module.exports = mongoose.model('adminUser', adminUser, 'adminUser');